package com.similarworld.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.similarworld.type.ItemStatus;


/**
 * Item entity
 * 
 * @author erdal.bitik
 * */

@Entity
@Table(name = "ITEMS")
public class Item extends AbstractModel {
	
	private static final long serialVersionUID = 1L;

	@Column(length=512)
	private String caption;

	@Column(length=2048)
	private String description;

	private Boolean commentable;
	
	/**
	 * Bu alan ilgili item'a ItemRate 
	 * verilmesi sirasinda guncellenecektir.
	 * */
	private Integer rate;
	
	/**
	 * Bu item icin yapilmis olan toplam rate
	 * sayisi
	 * */
	private Long rateCount;
	
	@Column(length=16)
	@Enumerated(value = EnumType.STRING)
	private ItemStatus status;
	
	@ManyToOne
	@JoinColumn(name = "CATEGORY_ID")
	private Category category;

	public Item() {
	}

	public String getCaption() {
		return caption;
	}

	public void setCaption(String caption) {
		this.caption = caption;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Boolean getCommentable() {
		return commentable;
	}

	public void setCommentable(Boolean commentable) {
		this.commentable = commentable;
	}

	public Integer getRate() {
		return rate;
	}

	public void setRate(Integer rate) {
		this.rate = rate;
	}

	public ItemStatus getStatus() {
		return status;
	}

	public void setStatus(ItemStatus status) {
		this.status = status;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public Long getRateCount() {
		return rateCount;
	}

	public void setRateCount(Long rateCount) {
		this.rateCount = rateCount;
	}
	
}

